#include "DemoContainerCommon.h"
#include "DemoContainer.h"

#include "DemoContainerUnitTestAddItem.h"

DemoContainerSuiteStubAddItemTest::DemoContainerSuiteStubAddItemTest()
{
  uintTestData_.insert(std::map<int, std::string>::value_type(0, ""));
  uintTestData_.insert(std::map<int, std::string>::value_type(1, "1"));
  uintTestData_.insert(std::map<int, std::string>::value_type(2, "1234567890"));
  uintTestData_.insert(std::map<int, std::string>::value_type(3, "sdfsfsdf\0dsfadsfaf\0"));
  uintTestData_.insert(std::map<int, std::string>::value_type(4, "sdf90546];';,;____"));
}

DemoContainerSuiteDriverAddItemTest::DemoContainerSuiteDriverAddItemTest()
{
  uintTestData_.insert(std::map<int, std::string>::value_type(0, "435435n%^%^^&*@#$%^&*(%^&"));
  uintTestData_.insert(std::map<int, std::string>::value_type(1, "1asdfadsf"));
  uintTestData_.insert(std::map<int, std::string>::value_type(2, "dslaewnfouewrlkcv;l349879340"));
  uintTestData_.insert(std::map<int, std::string>::value_type(3, "@#$%^&3$%^&*$%^&*34567834567899234567894567893456ERTYUIDFGHJVBNFG{:>}?}?FGHJK"));
  uintTestData_.insert(std::map<int, std::string>::value_type(4, "QW<>?"));
}

TEST_F(DemoContainerSuiteStubAddItemTest, TestAddItem1)
{
  DemoContainer container;
  EXPECT_EQ( ZERO, container.add_item( this->get_usedata()[ZERO] ) );
}

TEST_F(DemoContainerSuiteStubAddItemTest, TestAddItemSameData)
{
  DemoContainer container;
  EXPECT_EQ( ZERO, container.add_item( this->get_usedata()[ZERO] ) );
  EXPECT_EQ( MINUSONE, container.add_item( this->get_usedata()[ZERO] ) );
}

TEST_F(DemoContainerSuiteDriverAddItemTest, TestAddItemIndex)
{
  DemoContainer container;

  EXPECT_EQ( ZERO, container.add_item( this->get_usedata()[ZERO] ) );
  EXPECT_EQ( ONE, container.add_item( this->get_usedata()[ONE] ) );
  EXPECT_EQ( TWO, container.add_item( this->get_usedata()[TWO] ) );
  EXPECT_EQ( THREE, container.add_item( this->get_usedata()[THREE] ) );
  EXPECT_EQ( FOUR, container.add_item( this->get_usedata()[FOUR] ) );
}

TEST_F(DemoContainerSuiteDriverAddItemTest, TestAddItemMultiSameData)
{
  DemoContainer container;

  EXPECT_EQ( ZERO, container.add_item( this->get_usedata()[ZERO] ) );
  EXPECT_EQ( ONE, container.add_item( this->get_usedata()[ONE] ) );
  EXPECT_EQ( TWO, container.add_item( this->get_usedata()[TWO] ) );
  EXPECT_EQ( THREE, container.add_item( this->get_usedata()[THREE] ) );
  EXPECT_EQ( FOUR, container.add_item( this->get_usedata()[FOUR] ) );

  EXPECT_EQ( MINUSONE, container.add_item( this->get_usedata()[ZERO] ) );
  EXPECT_EQ( MINUSONE, container.add_item( this->get_usedata()[ONE] ) );
  EXPECT_EQ( MINUSONE, container.add_item( this->get_usedata()[TWO] ) );
  EXPECT_EQ( MINUSONE, container.add_item( this->get_usedata()[THREE] ) );
  EXPECT_EQ( MINUSONE, container.add_item( this->get_usedata()[FOUR] ) );
}
